STEPPER MOTOR INTERFACING WITH ARM
Every revolution of the stepper motor is divided into a discrete number of steps, and the motor must be sent a separate pulse for each step. It demonstrate the principle of stepper motor interfacing with ARM LPC2148 microcontroller.
Synopsis

A stepper motor is a brush less, synchronous electric motor that converts digital pulses into mechanical shaft rotation. Every revolution of the stepper motor is divided into a discrete number of steps, and the motor must be sent a separate pulse for each step. It demonstrate the principle of stepper motor interfacing with ARM LPC2148 microcontroller. It finds great application in field of microcontrollers such as robotics. Unipolar Motor is the most popular stepper motor among electronics hobbyist because of its ease of operation and availability.

Description

ARM is one of the major options available for embedded system developer. LPC2148 is the widely used IC from ARM-7 family. It is manufactured by Philips and it is pre-loaded with many inbuilt peripherals making it more efficient and a reliable option for the beginners as well as high end application developer.

ARM is a family of instruction set architectures for computer processors based on a reduced instruction set computing (RISC) architecture developed by British company ARM Holdings .A RISC-based computer design approach means ARM processors require significantly fewer transistors than typical processors in average computers. This approach reduces costs, heat and power use. These are desirable traits for light, portable, battery-powered devices including smartphones, laptops, tablet and notepad computers and other embedded systems. A simpler design facilitates more efficient multi-core CPUs and higher core counts at lower cost, providing higher processing power and improved energy efficiency for servers and supercomputers.


The ARM LPC2148 features are as follows:

1. Architecture: ARM v4T

2. Processor: ARM7-TDMI-S

3. Instructions: 32-bit ARM and 16-bit Thumb

4. Debug support: RT Embedded ICE, Embedded Trace interface

5. Static RAM: 32 KB

6. (On-chip)Additional: 8 KB for USB DMA

7. Flash Program: 512 KB

8. Mem.(On-chip)Programming: ISP/IAP via on-chip boot-loader program

9. GPIO No. of pins: up to 45 (fast GPIO lines, 5V tolerant), Configurable to fast GPIO

10. External Interrupts: Four; No. of pins: Nine

The ARM LPC2148 has two ports Port 0 and Port 1 respectively each port contains 32-bits for I/O operations. The Port 0 has 32-bit of I/O pins for individual directions and Port 1 has 32-bits of I/O pins for bidirectional purpose. It has two timers of each 32-bit. It has capable to storing 128-bit memory for interfacing.

Over the last few years, the ARM architecture has become the most pervasive 32-bitarchitecture in the world, with wide range of ICs available from various IC manufacturers. ARM processors are embedded in products ranging from cell/mobile phones to automotive braking systems. A worldwide community of ARM partners and third-party vendors has developed among semiconductor and product design companies, including hardware engineers, system designers, and software developers

Stepper motor is a brushless DC motor that divides the full rotation angle of 360° into number of equal steps. The motor is rotated by applying a certain sequence of control signals. The speed of rotation can be changed by changing the rate at which the control signals are applied. The motor's position can then be commanded to move and hold at one of these steps without any position sensor for feedback (an open-loop controller), as long as the motor is carefully sized to the application in respect to torque and speed.

Various stepper motors with different step angles and torque ratings are available in the market. Microcontroller can be used to apply different control signals to the motor to make it rotate according to the need of the application.

There are three main types of stepper motors

• Permanent magnet stepper

• Hybrid synchronous stepper

• Variable reluctance stepper

Permanent magnet motors use a permanent magnet (PM) in the rotor and operate on the attraction or repulsion between the rotor PM and the stator electromagnets. 

Variable reluctance (VR) motors have a plain iron rotor and operate based on the principle that minimum reluctance occurs with minimum gap, hence the rotor points are attracted toward the stator magnet poles.

The stepper motor is classified into two types based on the windings

• Unipolar stepper motor

• Bipolar stepper motor

Stepper motor interfacing with the ARM LPC2148 microcontroller we need to connect a motor driver with that, it may be ULN2003A or L293D based on the applications we can choose it.

L293D and L293 are dual H-bridge motor drivers. The L293D can provide bidirectional drive currents of up to 600-mA at voltages from 4.5 V to 36 V while L293 can provide up to 1A at same voltages. Both ICs are designed to drive inductive loads such as dc motors, bipolar stepping motors, relays and solenoids as well as other high-current or high-voltage loads in positive-supply applications. All inputs of these ICs are TTL compatible and output clamp diodes for inductive transient suppression are also provided internally. These diodes protect our circuit from the Back EMF of DC Motor. In both ICs drivers are enabled in pairs, with drivers 1 and 2 are enabled by a high input to 1,2EN and drivers 3 and 4 are enabled by a high input to 3,4EN. When drivers are enabled, their outputs will be active and in phase with their inputs. When drivers are disabled, their outputs will be off and will be in the high-impedance state.

ULN2003 is a monolithic high current and high voltage Darlington transistor arrays. ULN2003 consists of seven NPN Darlington Transistor pairs that have high-voltage outputs with common-cathode clamp diode for switching inductive loads. The collector-current rating of a single darlington pair can be up to 500mA. We can connect Darlington Transistor pairs in parallel if higher current capability is needed.

UNIPOLAR STEPPER MOTOR

The unipolar stepper motor is further classified into three stepping modes. They are as follows:

• Full step drive

• Half step drive

• Wave drive


Wave Drive:

In this mode only one stator electromagnet is energized at a time. It has the same number of steps as the full step drive but the torque is significantly less. It is rarely used. It can be used where power consumption is more important than torque.


Full Drive:

In this mode two stator electromagnets are energised at a time. It is the usual method used for driving and the motor will run at its full torque in this mode of driving.


Half Drive:

In this stepping mode, alternatively one and two phases are energised. This mode is commonly used to increase the angular resolution of the motor but the torque is less approximately 70% at its half step position (when only a single phase is on). We can see that the angular resolution doubles in Half Drive Mode.


Bipolar Stepper Motor

Bipolar motors are simpler in construction as it contains two coil and no centre tap. Being simple, driving is little complex compared to unipolar motors. To reverse the magnetic polarity of stator windings, current through it must be reversed. For this we should use H-Bridge. The L293d, H-Bridge Motor Driver for that. We can distinguish bipolar motors from unipolar motors by measuring the coil resistance. In bipolar motors we can find two wires with equal  resistance.


Applications

• Antennas

• Robotics

• Telescopes

• Some toys

• CT scanners

Proteus design for Unipolar Stepper Motor interfacing with ARM


Proteus design for Bipolar Stepper Motor interfacing with ARM


Orcad design for Unipolar Stepper Motor interfacing with ARM


Orcad design for Bipolar Stepper Motor interfacing with ARM


Full Drive Unipolar Stepper Motor interfacing with ARM

/*  Name     : main.c
 *  Purpose  : Source code for UNIPOLAR FULL STEP DRIVE STEPPER MOTOR Interfacing with ARM LPC1248.
 *  Author   : Gemicates
 *  Date     : 2018-03-02
 *  Website  : www.gemicates.org
 *  Revision : None
 */
#include <LPC214X.H>                             // header file for LPC21XX series

void delay( unsigned int value )                 // delay function declaration
{
unsigned int i,j;                                // This function produces a delay in msec
for(i=0;i<value;i++)
for(j=0;j<5000;j++);
}

int main()                                       // main function
{
unsigned char i;
IODIR0 =0x0000000F;
while(1)
{
for(i=0;i<1;i++)                                 // clockwise rotation
{
IOCLR0=0x0000000F;
IOSET0=0x00000003;
delay(1000);
IOCLR0=0x0000000F;
IOSET0=0x00000006;
delay(1000);
IOCLR0=0x0000000F;
IOSET0=0x0000000C;
delay(1000);
IOCLR0=0x0000000F;
IOSET0=0x00000009;
delay(1000);
}
for(i=0;i<1;i++)                                 // ANTIClock wise rotation
{
IOCLR0=0x0000000F;
IOSET0=0x00000009;
delay(1000);
IOCLR0=0x0000000F;
IOSET0=0x0000000C;
delay(1000);
IOCLR0=0x0000000F;
IOSET0=0x00000006;
delay(1000);
IOCLR0=0x0000000F;
IOSET0=0x00000003;
delay(1000);
}
}
}
    
Half Drive Unipolar Stepper Motor interfacing with ARM

/*  Name     : main.c
 *  Purpose  : Source code for UNIPOLAR HALF STEP DRIVE STEPPER MOTOR Interfacing with ARM LPC1248.
 *  Author   : Gemicates
 *  Date     : 2018-03-02
 *  Website  : www.gemicates.org
 *  Revision : None
 */
#include <LPC214X.H>                           // header file for LPC21XX series

void delay( unsigned int value )               // delay function declaration
{
unsigned int i,j;                              // This function produces a delay in msec
for(i=0;i<value;i++)
for(j=0;j<5000;j++);
}

int main()                                     // main function
{
unsigned char i;
IODIR0 =0x0000000F;
while(1)
{
for(i=0;i<1;i++)                               // clockwise rotation
{
IOCLR0=0x0000000F;
IOSET0=0x00000009;
delay(1000);
IOCLR0=0x0000000F;
IOSET0=0x00000001;
delay(1000);
IOCLR0=0x0000000F;
IOSET0=0x00000003;
delay(1000);
IOCLR0=0x0000000F;
IOSET0=0x00000002;
delay(1000);
IOCLR0=0x0000000F;
IOSET0=0x00000006;
delay(1000);
IOCLR0=0x0000000F;
IOSET0=0x00000004;
delay(1000);
IOCLR0=0x0000000F;
IOSET0=0x0000000C;
delay(1000);
IOCLR0=0x0000000F;
IOSET0=0x00000008;
delay(1000);
}
for(i=0;i<1;i++)                                // ANTIClock wise rotation
{
IOCLR0=0x0000000F;
IOSET0=0x00000008;
delay(1000);
IOCLR0=0x0000000F;
IOSET0=0x0000000C;
delay(1000);
IOCLR0=0x0000000F;
IOSET0=0x00000004;
delay(1000);
IOCLR0=0x0000000F;
IOSET0=0x00000006;
delay(1000);
IOCLR0=0x0000000F;
IOSET0=0x00000002;
delay(1000);
IOCLR0=0x0000000F;
IOSET0=0x00000003;
delay(1000);
IOCLR0=0x0000000F;
IOSET0=0x00000001;
delay(1000);
IOCLR0=0x0000000F;
IOSET0=0x00000009;
delay(1000);
}
}
}
     
Wave Drive Unipolar Stepper Motor interfacing with ARM

/*  Name     : main.c
 *  Purpose  : Source code for UNIPOLAR WAVE DRIVE STEPER MOTOR Interfacing with ARM LPC1248.
 *  Author   : Gemicates
 *  Date     : 2018-03-02
 *  Website  : www.gemicates.org
 *  Revision : None
 */
#include <LPC214X.H>                            // header file for LPC21XX series

void delay( unsigned int value )                // delay function declaration
{
unsigned int i,j;                               // This function produces a delay in msec
for(i=0;i<value;i++)
for(j=0;j<5000;j++);
}

int main()                                      // main function
{
unsigned char i;
IODIR0 =0x0000000F;
while(1)
{
for(i=0;i<1;i++)                                // clockwise rotation
{
IOCLR0=0x0000000F;
IOSET0=0x00000001;
delay(1000);
IOCLR0=0x0000000F;
IOSET0=0x00000002;
delay(1000);
IOCLR0=0x0000000F;
IOSET0=0x00000004;
delay(1000);
IOCLR0=0x0000000F;
IOSET0=0x00000008;
delay(1000);
}
for(i=0;i<1;i++)                               // ANTIClock wise rotation
{
IOCLR0=0x0000000F;
IOSET0=0x00000008;
delay(1000);
IOCLR0=0x0000000F;
IOSET0=0x00000004;
delay(1000);
IOCLR0=0x0000000F;
IOSET0=0x00000002;
delay(1000);
IOCLR0=0x0000000F;
IOSET0=0x00000001;
delay(1000);
}
}
}
   
Bipolar Stepper Motor interfacing with ARM

/*  Name     : main.c
 *  Purpose  : Source code for BIPOLAR STEPPER MOTOR Interfacing with ARM LPC1248.
 *  Author   : Gemicates
 *  Date     : 2018-03-02
 *  Website  : www.gemicates.org
 *  Revision : None
 */
#include <LPC214X.H>                                       // header file for LPC21XX series
                   
void delay( unsigned int value )                           // delay function declaration
{
unsigned int i,j;                                          // This function produces a delay in msec
for(i=0;i<value;i++)
for(j=0;j<5000;j++);
}

int main()                                                 // main function
{
unsigned char i;
IODIR0 =0x0000000F;
while(1)
{
for(i=0;i<1;i++)                                           // clockwise rotation
{
IOCLR0=0x0000000F;
IOSET0=0x00000008;
delay(1000);
IOCLR0=0x0000000F;
IOSET0=0x00000002;
delay(1000);
IOCLR0=0x0000000F;
IOSET0=0x00000004;
delay(1000);
IOCLR0=0x0000000F;
IOSET0=0x00000001;
delay(1000);
}
for(i=0;i<1;i++)                                          // ANTIClock wise rotation
{
IOCLR0=0x0000000F;
IOSET0=0x00000001;
delay(1000);
IOCLR0=0x0000000F;
IOSET0=0x00000004;
delay(1000);
IOCLR0=0x0000000F;
IOSET0=0x00000002;
delay(1000);
IOCLR0=0x0000000F;
IOSET0=0x00000008;
delay(1000);
}
}
}
    

Error message here!

Show Error message here!


Forgot your password?

Error message here!

Send OTP

Error message here!

Show Error message here!


Lost your password? Please enter your email address. You will receive a password you Need.

Send Error message here!


Back to log-in

Close